<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/iron-validator-behavior/iron-validator-behavior.html">
<script>
    Polymer({

        is: 'cidr-validator',

        behaviors: [
            Polymer.IronValidatorBehavior
        ],

        validate: function (str) {
            if (str && !(/^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$/.test(str.trim()))) {
                return false;
            }
            return true;
        }

    });
</script>